/**
 * Created by ZFL on 2017/9/21.
 */
var vm=new Vue({
    el:'#recruit',
    data:{
        nickName:'',   //昵称
        roleName:''    //角

    }
})
function PageInit(){
    checkInfo();        //查询邀请人的头像
    var qrcode=new QRCode(document.getElementById("qrcode"),{
        text:""+$.wxApi()+"b2c/recruit/join.html?inviterUserId="+userId,
        width: 150,
        height: 150,
        colorDark : "#000000",
        colorLight : "#ffffff",
        correctLevel : QRCode.CorrectLevel.H

    })
}
var userId=$.getPara('userId');
console.log(typeof(userId));
//查询邀请人的头像
function checkInfo() {
    $.ajaxHandler({
            model: function () {
                var obj = {};
                obj.userId = $.getPara('userId');
                return obj;
            },
            visibleTime: 0,
            dataType: "json",
            approve: true,
            api: 'yg_baijiaapporder/user/getUserEntityByIdNoPassword',
            success: function (result) {
                //console.log(result);
                if (result.code == 10000) {
                    var data=result.data;
                    if(data.picture!=""){
                        $(".code label").css("background",'url('+data.picture+')no-repeat left top/100% 100%');//用户头像
                    }
                    vm.nickName=data.nickName;
                    if(userId>=1&userId<60){
                        vm.roleName='VIP';
                    }else if(userId>=200&userId<600){
                        vm.roleName='店主';
                    }else if(userId>=600&userId<700){
                        vm.roleName='合伙人';
                    }else if(userId>=700){
                        vm.roleName='慧空间';
                    }else{
                        //vm.roleName='nihao';
                    }

                }else{
                    YDUI.dialog.toast(result.message, 'error', 1000);
                }

            }
        }
    );
}